<template>
  <div class="operationLog">
    <DFPageList ref="dfPageListRef" :page-options="pageOptions" />
  </div>
</template>

<script lang="ts" setup name="OperationLog">
import lang from './lang'
import {  pageOperationLog } from '@/api/system/operationLog'
import { useMixins } from '@/hooks/useMixins'

const { loadLangFn ,t} = useMixins()

const dfPageListRef: any = ref(null)

loadLangFn(lang)

const pageOptions = {
  searchForm: {
    formSchemas: [
      {
        label: 'type',
        component: 'NSelect',
        options: [
          {
            label: t('common.button.add'),
            value: 'add',
          },
          {
            label: t('common.button.update'),
            value: 'update',
          },
          {
            label: t('common.button.delete'),
            value: 'delete',
          },
        ],
      },
      {
        label: 'msg',
        component: 'NInput',
      },
      {
        label: 'ip',
        component: 'NInput',
      },
      {
        label: 'mac',
        component: 'NInput',
      },
      {
        label: 'syncHostSqlite',
        component: 'NSelect',
        options: [
          {
            label: t('common.button.yes'),
            value: 1,
          },
          {
            label: t('common.button.no'),
            value: 0,
          },
        ],
      },
      {
        label: 'remark',
        component: 'NInput',
        common:true
      },
    ],
  },
  table: {
    columns: [
      {
        width: 120,
        label: 'type',
        render: (row) => {
          return h('span', {
            innerText: t(`common.button.${row.type}`)
          });
        }
      },
      {
        width: 120,
        label: 'msg',
      },
      {
        width: 120,
        label: 'mac',
      },
      {
        width: 120,
        label: 'ip',
      },
      {
        width: 120,
        label: 'syncHostSqlite',
        render: (row) => {
          return h('span', {
            innerText: t(`common.button.${row.syncHostSqlite?'yes':'no'}`)
          });
        }
      },
      {
        width: 120,
        label: 'remark',
        common: true,
      },
    ],
    requestFn: pageOperationLog,
  },
}

// nextTick(() => {
//   dfPageListRef.value && dfPageListRef.value.openModalFn();
// });
</script>
